//
//  HORepairerEntity.m
//  微度报修
//
//  Created by foguo-mac-1 on 7/4/16.
//  Copyright © 2016 WeiDu. All rights reserved.
//

#import "HORepairerEntity.h"
#import "HOConstants.h"
#import "HOUtils.h"

@implementation HORepairerEntity
- (instancetype)init
{
	self = [super init];
	if(self)
	{
	}
	return self;
}


- (void)parseDic:(NSDictionary *)dic
{
	self.userId = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_UserId]] intValue];
	self.userName = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_UserName]];
	self.gender = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_Gender]];
	self.age = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_Age]] intValue];
	self.headPic = [HOUtils getValideString:[dic objectForKey:@"HeadPic"]];
	self.depName = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepName]];
	self.level = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_Level]];
	self.introduce = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_Introduction]];
	self.workId = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_WorkeId]];
	self.HopeName = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_HopeName]];
	self.appraise = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_Appraise]] floatValue];
	self.virtualCellPhone = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_VirtualCellPhone]];
	self.isWorking = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_WorkStatus]] intValue] == 1; //1在线，2离线;
	self.appraise = MIN(self.appraise, 5);
	
	NSDictionary *appraiseDic = [dic objectForKey:kHO_FIELD_AppraiseInfo];
	if([appraiseDic.allKeys count] == 0)
	{
		self.appraiseEntity = nil;
	}
	else
	{
		self.appraiseEntity = [[[HOAppraiseEntity alloc] init] autorelease];
		[self.appraiseEntity parseDic:appraiseDic];
	}
//	@property(nonatomic, retain)NSString *userName;//String型 维修人员姓名
//	@property(nonatomic, retain)NSString *gender;//String型，维修人员性别
//	@property(nonatomic, assign)int age;//int型，维修人员年龄
//	@property(nonatomic, retain)NSString *headPic;//String型 维修人员头像
//	@property(nonatomic, retain)NSString *appraise;//String型 ,总体评分值
//	@property(nonatomic, retain)NSString *depName;//String型 维修部门名称
//	@property(nonatomic, retain)NSString *level;//String型 职位名称
//	@property(nonatomic, retain)NSString *introduce;//String,个人介绍,
//	@property(nonatomic, retain)NSString *workId;//String,工作编号,
}

- (void)dealloc
{
	self.appraiseEntity = nil;
	self.userName = nil;
	self.gender = nil;
	self.headPic = nil;
	self.depName = nil;
	self.level = nil;
	self.introduce = nil;
	self.workId = nil;
	[super dealloc];
}


@end
